- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2k
Comment denoted hydration #4636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 📊 Tachometer Benchmark ResultsSummaryduration
 usedJSHeapSize
 Resultscreate10kduration
 usedJSHeapSize
 filter-listduration
 usedJSHeapSize
 hydrate1kduration
 usedJSHeapSize
 many-updatesduration
 usedJSHeapSize
 replace1kduration
 usedJSHeapSize
 run-warmup-0
 run-warmup-1
 run-warmup-2
 run-warmup-3
 run-warmup-4
 run-final
 text-updateduration
 usedJSHeapSize
 tododuration
 usedJSHeapSize
 update10th1kduration
 usedJSHeapSize
 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
src/diff/children.js:133
- [nitpick] The variable name 'toResolve' is ambiguous. It should be renamed to something more descriptive like 'commentMarkersToResolve'.
let toResolve = 0;
src/diff/children.js:134
- Ensure that the new logic for handling comment nodes is covered by tests.
while ((oldDom && oldDom.nodeType == 8) || toResolve > 0) {
| Size Change: +755 B (+1.25%) Total Size: 61.1 kB 
 ℹ️ View Unchanged
 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this took so long, wanted to find time to go back through your RFC & the RTS pull as my memory had become rusty. Looks great!
Re:comprehensive test suite, certainly would be a big benefit though I imagine it'd be a fair bit of work to cover all the various situations. Wonder how comprehensive React's suite is, might be able to repurpose some tests with less effort than writing from scratch.
4988f25    to
    c0abb28      
    Compare
  
    c0abb28    to
    3c4204c      
    Compare
  
    * Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
* Remove unused imports * Comment denoted hydration * Make it work * Golfies
Relates to #4442
Implementation from preactjs/preact-render-to-string#376
Supersedes #4444
This implements a hydration approach with the comment markers, one thing that's noteworthy is that
oldDomin ourdiffChildrenalgorithm becomes stale.We diff the wrapping element of the Suspense and non-suspenseful child, we get to an oldDom which is the first child-node of said series. When we suspend we don't move oldDom, we can try and move it inside of
diffbut this won't affect the continueddiffChildrenso we are stuck inserting that node in front of our oldDom.This has been solved in 647d138 through correctly skipping comment nodes while placing children.
I think the last part of this research would be to set up a comprehensive test suite for both
renderToStringAsyncas well asrenderToStreamso we can have fixtures for this behaviour, what do you all think?